import Mock from "mockjs";
import { Local } from "../utils";
class smsEntity {
  fieldsSession = Local('smsEntity-fields', Mock.mock([{
    sms_name: "阿里云短信",
    desc: "@cword(50)",
    "is_use|0-1": 0,
    access_key_id: "",
    access_key_secret: "",
    smssign: "",
  }]))
  get fields() {
    return this.fieldsSession.get();
  }
  set fields(obj: any) {
    this.fieldsSession.set(obj)
  }
  findAll() {
    return this.fields;
  }
  update(rows: any) {
    let obj = this.findAll();
    Object.entries(rows).forEach((item:any) => {
      obj[0][item[0]] = item[1];
    })
    this.fields = obj;
  }
}

export default smsEntity;